x86/DMI: fix table mapping when one lives above 1Mb
authorJan Beulich <jbeulich@suse.com>
Tue, 24 Nov 2020 10:26:34 +0000 (11:26 +0100)
committerMaximilian Engelhardt <maxi@daemonizer.de>
Thu, 23 Mar 2023 19:40:49 +0000 (19:40 +0000)
commit1118637d9bac3a44ab8a2d7705a4a60cdf4ea734
treee6abea82801532a8c37d0e49104b8acdb9371095
parentb322448f7809873575fb6aa7daa3d036a86fd5a7
x86/DMI: fix table mapping when one lives above 1Mb

Use of __acpi_map_table() is kind of an abuse here, and doesn't work
anymore for the majority of cases if any of the tables lives outside the
low first Mb. Keep this (ab)use only prior to reaching SYS_STATE_boot,
primarily to avoid needing to audit whether any of the calls here can
happen this early in the first place; quite likely this isn't necessary
at all - at least dmi_scan_machine() gets called late enough.

For the "normal" case, call __vmap() directly, despite effectively
duplicating acpi_os_map_memory(). There's one difference though: We
shouldn't need to establish UC- mappings, WP or r/o WB mappings ought to
be fine, as the tables are going to live in either RAM or ROM. Short of
having PAGE_HYPERVISOR_WP and wanting to map the tables r/o anyway, use
the latter of the two options. The r/o mapping implies some
constification of code elsewhere in the file. For code touched anyway
also switch to void (where possible) or uint8_t.

Fixes: 1c4aa69ca1e1 ("xen/acpi: Rework acpi_os_map_memory() and acpi_os_unmap_memory()")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
(cherry picked from commit f390941a92f102ebbbbce1b54be206a602187fd7)

Gbp-Pq: Name 0042-x86-DMI-fix-table-mapping-when-one-lives-above-1Mb.patch
xen/arch/x86/dmi_scan.c